package com.atguigu.gmall.search.bean;

import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;


/**
 * JavaBean 上使用注解声明bean与es数据的映射信息 @Document
 */
@Data
@Document(indexName = "gmallperson",//索引名字
        createIndex = true, //为表创建索引
        shards = 3, //分片，存储分片
        replicas = 2) //副本

@AllArgsConstructor //全参构造器
@NoArgsConstructor //无参构造器
@ToString //方法
public class Person {

    @Id
    private Long id;//主键字段

    @Field(type = FieldType.Keyword)
    private String name;

    @Field(type = FieldType.Text) //全文检索文本
    private String address;

    @Field(type = FieldType.Integer) //这是es文档要保存的数据
    private Integer age;


}
